#ifndef DEPOTVIEW_H
#define DEPOTVIEW_H

#include <QObject>
#include <QListView>
#include <QTableView>
#include <QStringList>
#include <QStringListModel>
#include <QDropEvent>
#include <QLabel>
#include "depot.h"
#include "draglist.h"
#include "droptable.h"
#include "global/global.h"

class DepotView : public QObject
{
    Q_OBJECT

public:
    explicit DepotView(QObject *parent = 0);
    ~DepotView();

    void attachStockNameListView(DragList* View);
    void attachDepotNameListView(QListView* View);
    void attachStockTableView(DropTable* View);
    void attachStandardLabels(QLabel* liquidityLabel,QLabel* standardProvisionLabel,QLabel* currentLiquidityLabel);

    void attachTradeTable(QTableView* table);

    virtual QStringList getAllDepotNames()const=0;
    //virtual QStringList getStockNames()const=0;
    virtual Depot* getDepot(const QString& depotName)const=0;

    virtual void addStockToDepot(const QString& depotName,const QString& stockName,int flag=NO_FLAG)=0;

    DropTable* getDropTable();

protected:

signals:
    void addStockSignal(const QString& stockName);
    void depotChangedSignal(int index);

public slots:
    void refresh();
    void depotNameClicked(QModelIndex);
    void tableItemDropped(QDropEvent* event);
    void newStockValue();
    void show();


private:
    DragList *stockNameView;     //don't delete, have to be attached by the mainwindow
    QListView *depotNameView;   //don't delete
    DropTable *stockTableView;                  //don't delete
    QStringListModel *depotNameModel;                        //don't delete
    QStringListModel *stockNameModel;                        //don't delete
    QString currentDepotName;
    QLabel *liqLabel,*stdProvLabel,*cLiqLabel;             //don't delete
    QTableView* tradeTable;                     //don't delete
};

#endif // DEPOTVIEW_H
